<template>
  <div class="page-main" v-title data-title="工程项目变更列表">
    <home-nav :userData="userinfo"></home-nav>
    <div class="banner"><span>工程项目变更列表</span></div>
    <div class="container">
      <div class="header" style="padding: 10px 0px">
        <a-row type="flex" justify="space-between" align="middle">
          <a-col :xl="{ span: 14 }" :lg="{ span: 11 }">
            <a-button class="hte-btn add-btn" type="primary" @click="handleAdd">创建</a-button>
            <a-button class="hte-btn" plain @click="handleExport">导出</a-button>
            <a-button class="hte-btn" plain @click="handleReload">刷新</a-button>
            <a-button class="hte-btn" plain @click="handleDel" style="color: red">删除</a-button>
          </a-col>
          <a-col :xl="{ span: 9 }" :lg="{ span: 13 }" class="input-ground">
            <a-input-group compact>
              <a-select v-model="keywordType" @change="changeKeywordType">
                <a-select-option value="1"> 变更单号</a-select-option>
                <a-select-option value="2"> 项目编号 </a-select-option>
              </a-select>
              <a-input-search
                v-if="keywordType == '1'"
                v-model="searchForm.projectChangeNo"
                @search="handleToSearch"
                placeholder="请按照关键字进行搜索"
              />
              <a-input-search
                v-if="keywordType == '2'"
                v-model="searchForm.projectNo"
                @search="handleToSearch"
                placeholder="请按照关键字进行搜索"
              />
            </a-input-group>
            <a-button class="hte-btn del-btn" @click="showSearchForm = true">高级搜索</a-button>
          </a-col>
        </a-row>
        <a-modal
          :visible="showSearchForm"
          width="70vw"
          :bodyStyle="{ padding: '10px' }"
          title="高级查询"
          @ok="handleToSearch"
          @cancel="showSearchForm = false"
        >
          <a-form-model
            ref="ruleForm"
            :label-col="labelCol"
            :wrapper-col="wrapperCol"
            @keyup.enter.native="handleToSearch"
          >
            <a-row :gutter="24">
              <a-col :span="8">
                <a-form-model-item label="审批状态">
                  <a-select v-model="searchForm.withInStatus" style="width: 100%" allowClear>
                    <a-select-option value=""> 全部 </a-select-option>
                    <a-select-option
                      v-for="(code, index) in codes.InfrastructureStatus"
                      :key="index"
                      :value="code.code"
                    >
                      {{ code.name }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <a-form-model-item label="变更单号">
                  <a-input allow-clear v-model="searchForm.projectChangeNo" />
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <a-form-model-item label="项目编号">
                  <a-input allow-clear v-model="searchForm.projectNo" />
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row :gutter="24">
              <a-col :span="8">
                <a-form-model-item label="项目名称">
                  <a-input allow-clear v-model="searchForm.projectName" />
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <a-form-model-item label="变更名称">
                  <a-input allow-clear v-model="searchForm.projectChangeName" />
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <a-form-model-item label="项目经理">
                  <a-input allow-clear v-model="searchForm.projectManager" />
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row :gutter="24">
              <a-col :span="8">
                <a-form-model-item label="主要负责人">
                  <a-input allow-clear v-model="searchForm.dutyUserName" />
                </a-form-model-item>
              </a-col>
            </a-row>
          </a-form-model>
        </a-modal>
      </div>
      <div class="floatNav">
        <!-- <div class="budget-detail" @click="toMyTask">
          <span class="iconfont icon-reportReserve"></span>
          <a-badge :offset="[-11, -15]">
            <p>我的报工单</p>
          </a-badge>
        </div> -->
        <!-- <div class="budget-detail">
          <span class="iconfont icon-reportReserve"></span>
          <a-badge count="22" :offset="[-11, -15]">
            <p>验收付款单</p>
          </a-badge>
        </div> -->
      </div>
      <div class="content-list">
        <a-table
          :scroll="{ x: 1800 }"
          :columns="columns"
          :data-source="records"
          rowKey="id"
          bordered
          :pagination="false"
          :customRow="customRow"
          :loading="loading"
          :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
        >
        </a-table>
        <a-pagination
          show-size-changer
          :default-current="1"
          :total="searchForm.total"
          @change="pageChange"
          @showSizeChange="onShowSizeChange"
          :show-total="(total) => `共 ${total} 条记录`"
        />
      </div>
    </div>
  </div>
</template>

<script>
import { ProjectChangeListMixin } from '@/views/projectChange/ProjectChangeListMixin'
import { getParamValFromUrl, caseToShow } from '@/utils/common.js'
export default {
  mixins: [ProjectChangeListMixin],
  components: {
    HomeNav: () => import('@/components/layouts/HomeNav'),
  },
  data() {
    return {
      currUserId: this.$store.getters.userInfo.username,
      userinfo: {
        info: this.$store.getters.userInfo,
        module: 'ContractReportInfo',
      },
    }
  },
  mounted() {
    if(getParamValFromUrl("projectNo")){
      this.$set(this.searchForm, 'projectNo', getParamValFromUrl("projectNo"))
    }
    this.fetchList()
  },
  methods: {},
  watch: {},
}
</script>

<style lang="less" scoped>
@import '~@assets/less/hte-main.less';
.page-main {
  .container {
    .content {
      margin-top: 20px;
      section {
        margin-bottom: 18px;
        .section-table {
          .add-btn {
            margin-left: 0;
            margin-bottom: 10px;
          }
          /deep/ .a-upload__input {
            display: none !important;
          }
        }
      }
    }
  }
  .tips-box {
    margin-top: 32px;
    .add-btn {
      width: 180px;
      height: 40px;
      line-height: 40px;
      background-color: #4095e4;
      border-radius: 2px;
    }
  }
}
/deep/ .el-upload__input {
  display: none !important;
}
</style>
